// reducer.ts
import { LOGIN, LOGOUT } from './actions';

const initialState = {
    isLoggedIn: false,
    account: null,
    code: null
};

function reducer(state = initialState, action: any) {
    switch (action.type) {
        case LOGIN:
            return { ...state, isLoggedIn: true, account: action.account, code: action.code };
        case LOGOUT:
            return { ...state, isLoggedIn: false, account: null, code: null };
        default:
            return state;
    }
}

export default reducer;